﻿using System.Data.SqlClient;
using System.Windows.Forms;
using System.Data;
using System.Linq;
namespace HelperPrototype.Reports {
    
    
    public partial class DS_DanhSachNhaCungCap {
        partial class HangHoa_NhaCungCapDataTable
        {
        }
        public void fillData()
        {

            
            SqlConnection con = new SqlConnection(Properties.Settings.Default.myConnectionString);
            con.Open();

            string sql = "select H.*,N.*,P.* "+
                "from dbo.HangHoa_NhaCungCap HN,dbo.HangHoa H,dbo.NhaCungCap N,dbo.PhieuDanhGiaNCC P "+
                "where Dat= 1 And HN.MaHangHoa=H.MaHangHoa And HN.MaNhaCungCap=N.MaNhaCungCap And HN.PhieuDanhGiaNCC_ID=P.MaPhieu And P.TrangThai=5";
            SqlDataAdapter dataAdaptor = new SqlDataAdapter(sql, con);
            dataAdaptor.Fill(this, "HangHoa_NhaCungCap");

            //DS_PhieuMuaHang.PhieuDeNghiMuaHangDataTable tb = new DS_PhieuMuaHang.PhieuDeNghiMuaHangDataTable();
            //DS_PhieuMuaHangTableAdapters.PhieuDeNghiMuaHangTableAdapter da = new DS_PhieuMuaHangTableAdapters.PhieuDeNghiMuaHangTableAdapter();

            //da.Fill(tb, ID);

        }

        public void viewReport()
        {

            //_DB.DataClasses1DataContext dc = new _DB.DataClasses1DataContext();
            //_DB.PhieuDeNghiMuaHang P = dc.PhieuDeNghiMuaHangs.Single(s => s.MaPhieu == Ma);





            trash.CR_DanhSachNhaCungCaoDuocChon report = new trash.CR_DanhSachNhaCungCaoDuocChon();
            report.SetDataSource(this);
            //report.SetParameterValue("MaPhieu", P.MaPhieu);
            //report.SetParameterValue("MaNguoiTao", P.NguoiTao.Ten);
            //report.SetParameterValue("NoiDung", P.NoiDung);
            ReportViewerForm form = new ReportViewerForm(report);
            form.ShowDialog();
        }
    }
}
